img=imread("img.jpg");
% img=rgb2gray(img);
subplot(2,2,1),imshow(img),xlabel("(a)原图像");
times=4;
img2=imresize(img,img/times);
subplot(2,2,2),imshow(img2),xlabel("(b)失真图像");
%法一
g1=interp2(double(img2),"cubic");
subplot(2,2,3),imshow(uint8(g1)),xlabel("(c)双三次插值图像（法一）");
%法二
[m,n]=size(img2);
[x,y]=meshgrid(1:m,1:n);
[xi,yi]=meshgrid(1:m*times,1:n*times);
g2=interp2(x,y,double(img2),xi/times,yi/times,"cubic");
subplot(2,2,4),imshow(uint8(g2)),xlabel("(d)双三次插值图像（法二）");